﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using PGMHelper;

namespace BeamRein
{
    public class Beam
    {
        /// <summary>
        /// 名称
        /// </summary>
        public string Name { set; get; }

        /// <summary>
        /// 配筋信息
        /// </summary>
        public ReinforceInfo Reinforce { set; get; }

        /// <summary>
        /// 获得梁类型
        /// </summary>
        /// <returns></returns>
        public BeamEnum GetBeamType()
        {
            //框架梁
            if (this.Name.Contains("KL") || this.Name.Contains("WKL"))
                return BeamEnum.KL;
            //转换梁
            else if (this.Name.Contains("KZL") || this.Name.Contains("TZL"))
                return BeamEnum.ZL;

            //连梁
            else if (this.Name.Contains("LL") || this.Name.Contains("LLk"))
                return BeamEnum.LL;
            //悬挑梁
            else if (this.Name.Contains("XL")) return BeamEnum.XL;
            //井字梁
            else if (this.Name.Contains("JZL") || this.Name.Contains("JZLg"))
                return BeamEnum.JZ;
            //空心楼盖梁
            else if (this.Name.Contains("BL"))
                return BeamEnum.BL;
            //次梁
            else return BeamEnum.L;
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="str"></param>
        public Beam(string str)
        {
            //初始化
            this.Reinforce = new ReinforceInfo();
            //拆分语句
            var strList = WilsonHelper.SplitStr(str);
            //名称
            this.Name = strList.First();
            //信息
            this.Reinforce.SetBeamInfo(strList);
        }
    }
}
